class Solution {
public:
    int reversePairs(vector<int>& nums) {
        int sizeOfNums = nums.size();
        if(sizeOfNums < 2 || sizeOfNums > 50000)  return 0;
        /*
        直接法:时间复杂度O(n*n)过高
        */
        int tiems = 0;//逆序对总数
        int i = 0;
        while(i < sizeOfNums)
        {
            int j = i + 1;
            while(j < sizeOfNums)
            {
                if(nums[i] > nums[j])  ++tiems;
                ++j;
            }
            ++i;
        }

        return tiems;
    }
};